#include "ScnsSmctp.c.h"

#if defined(SCNS_SMCTP_ENABLE)&&SCNS_SMCTP_ENABLE==1

#include "ScnsMenu.h"
#include "ScnsMath.h"

const ScnsSmctpChanelConfig scnsSmctpChanelConfig[SCNS_SMCTP_CHANNEL_MAX]={
    [SCNS_SMCTP_CHANNEL_MENU]={.callback=scnsMenuReceiveInterrupt},

};

ScnsStatus scnsBspSmctpInit(void)
{
    uart_init(UART_1,460800,UART1_TX_A9,UART1_RX_A10);
    UART1->IER|=UART_ISR_RXINTF_MASK;
    interrupt_enable(UART1_IRQn);
    interrupt_set_priority(UART1_IRQn,1);
    return SCNS_STATUS_OK;
}

ScnsStatus scnsBspSmctpPostInit(void)
{
    return SCNS_STATUS_OK;
}

ScnsStatus scnsBspSmctpCanSend(void)
{
    return SCNS_STATUS_OK;
}


void scnsBspSmctpSend(const uint8*buf,uint32 *len)
{
    *len=scnsMin(*len,30);
    uart_write_buffer(UART_1,buf,*len);
    scnsSmctpSendFinishCallback();
}
#endif